package com.fast.cron.db.dao;

import com.fast.cron.db.entry.Job;

import java.sql.SQLException;
import java.util.List;

/**
 * @author: Leo Jie
 * @date: 2018-10-02 21:18
 * @version: v1.0
 */
public interface JobDao {
    /**
     * add job
     *
     * @param job job obj that to add
     * @return row number
     * @throws SQLException the error when execute sql
     */
    long addJob(Job job) throws SQLException;

    /**
     * remove job
     *
     * @param jobId job id
     * @return row number
     * @throws SQLException the error when execute sql
     */
    int removeJob(int jobId) throws SQLException;

    /**
     * find one job by id
     *
     * @param jobId the id of one job
     * @return the job obj of result
     * @throws SQLException the error when execute sql
     */
    Job findOneJobById(int jobId) throws SQLException;

    /**
     * find job list by user
     *
     * @param username the name of user
     * @return list result of jobs
     * @throws SQLException the error when execute sql
     */
    List<Job> findJobListByUser(String username) throws SQLException;

}
